import json
from api.base_service import BaseService

# 封装预约设置服务
class OrderSettingService(BaseService):
    def __init__(self):
        super().__init__()
        self.service_name="OrderSettingService"

    def add(self,data_list):
        resp=self.dubbo_client.invoke(self.service_name,"add",data_list)
        if resp=="Failed":
            return False
        else:
            return True

    def get_order_setting_by_month(self,months):
        resp = self.dubbo_client.invoke(self.service_name, "getOrderSettingByMonth", months)
        if resp=="Failed":
            return None
        else:
            return json.loads(resp)

    def edit_number_by_date(self,date):
        date["class"] = "com.itheima.pojo.OrderSetting"
        resp = self.dubbo_client.invoke(self.service_name, "editNumberByDate", date)
        if resp == "Failed":
            return False
        else:
            return True
